<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>if练习3.1</title>
    <script>
        //prompt()返回值是String类型
        //+prompt()可以将prompt()的返回值转换为Number类型
        var num1 = +prompt("请输入num1"),
            num2 = +prompt("请输入num2"),
            num3 = +prompt("请输入num3");


        //找到三个数的最小值
        if (num1 < num2 && num1 < num3) {
            //num1最小，比较num2和num3
            if (num2 < num3) {
                document.write("排序顺序为：" + num1 + "<" + num2 + "<" + num3);
            } else {
                document.write("排序顺序为：" + num1 + "<" + num3 + "<" + num2);
            }
        } else if (num2 < num1 && num2 < num3) {
            //num2最小，比较num1和num3
            if (num1 < num3) {
                document.write("排序顺序为：" + num2 + "<" + num1 + "<" + num3);
            } else {
                document.write("排序顺序为：" + num2 + "<" + num3 + "<" + num1);
            }
        } else {
            //num3最小，比较num2和num1
            if (num1 < num2) {
                document.write("排序顺序为：" + num3 + "<" + num1 + "<" + num2);
            } else {
                document.write("排序顺序为：" + num3 + "<" + num2 + "<" + num1);
            }
        }
    </script>
</head>

<body>

</body>

</html>